﻿@page
@model OpenPms.Areas.D.Pages.Setup.RoomModel
@{
    ViewData["Title"] = "房间";
}
<nav aria-label='breadcrumb'>
    <ol class='breadcrumb'>
        
        <li class='breadcrumb-item active' aria-current='page'>
            @ViewBag.Title |
            <a href="javascript:;" onclick="Save()">保存</a> |
            <a href="javascript:;" onclick="Create()" data-bs-title="先保存，后添加" data-bs-toggle="tooltip">添加</a>
        </li>
    </ol>
</nav>


<form method="post" id="FormPost">

    <desk-input-items asp-Items="Items" asp-rowno=1
                      asp-hidden-1=Item.Id 
                      asp-for-1=Item.RoomNo
                      asp-for-2=Item.RoomTypeId asp-select-2=ViewBag.SelectItems
                      asp-for-5=Item.ArrangeIndex
                      asp-for-3=Item.Desc
                      asp-for-4=Item.IsDelete />

</form>

@section Scripts {
    @{
        await Html.RenderPartialAsync("_ValidationScriptsPartial");
    }
    <script>
        var flag = "@Model.Flag";
        $(function () {
            if (flag == "0")
                ShowToast("保存成功！");
            else if (flag == "1")
                ShowToast("保存并添加成功！");
        });
        function Create() {
            $("#FormPost").attr("action", "@Url.Page("./Room")" + "?flag=1");
            $("#FormPost").submit();
        }
        function Save() {
            $("#FormPost").attr("action", "@Url.Page("./Room")" + "?flag=0");
            $("#FormPost").submit();
        }
    </script>
}

